<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<div class="ddp-data-namesub">
  <!-- database name -->
  <div class="ddp-data-in" [ngClass]="{'ddp-selected':isDatabaseSearchShow}" [class.ddp-disabled]="disable" (click)="databaseSearchShow()" (clickOutside)="isDatabaseSearchShow=false">
    <em class="ddp-icon-database3"></em>
    <span class="ddp-txt-namesub">{{selectedDatabaseName}}</span>
    <em class="ddp-icon-view" ></em>
    <!-- Select box -->
    <div class="ddp-box-layout4" *ngIf="isDatabaseSearchShow" (click)="$event.stopImmediatePropagation()">
      <!-- search -->
      <div class="ddp-wrap-search">
        <div class="ddp-form-search">
          <em class="ddp-icon-search"></em>
          <input
            #inputSearch
            [ngModel]="searchText"
            (keypress)="onSearchDatabase($event)" (keyup.esc)="onSearchDatabaseInit()"
            type="text" placeholder="{{'msg.bench.ui.db.name.search'|translate}}" >
          <em *ngIf="isShowBtnClear()" (click)="onSearchDatabaseInit()" class="ddp-btn-search-close" ></em>
        </div>
      </div>
      <!-- //search -->
      <div class="ddp-ui-list-type">
        <ul class="ddp-list-type ddp-list-popup">
          <li *ngFor="let item of databases" (click)="selectedDatabase(item)"
              [class.ddp-selected]="item === selectedDatabaseName" >
            <a href="javascript:">
              <em class="ddp-icon-database-s"></em>
              <span class="ddp-data-name">{{item}}</span>
              <em class="ddp-icon-check"></em>
            </a>
          </li>
        </ul>
        <a *ngIf="isShowMore" (click)="moreDatabases($event);"
           href="javascript:" class="ddp-btn-more" >+ {{'msg.comm.ui.more' | translate}}</a>
      </div>
    </div>
    <!-- // Select box -->
  </div>
  <!-- // database name -->
  <!-- table button -->
  <a href="javascript:" class="ddp-link-btn" [ngClass]="{'ddp-disabled':disable}" (click)="openSchemaBrowser()">
    <em class="ddp-icon-table"></em>
  </a>
  <!-- // table button -->
</div>
